﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    public static class NumericsHelper
    {
        public static System.Numerics.Vector2 ToVector2(this System.Windows.Point point)
        {
            return new Numerics.Vector2(Convert.ToSingle(point.X), Convert.ToSingle(point.Y));
        }
        public static System.Numerics.Vector2 ToVector2(this System.Windows.Vector point)
        {
            return new Numerics.Vector2(Convert.ToSingle(point.X), Convert.ToSingle(point.Y));
        }
        public static System.Numerics.Vector2[] ToVector2(this System.Windows.Point[] points)
        {
            System.Numerics.Vector2[] vector2s = new Numerics.Vector2[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                vector2s[i] = points[i].ToVector2();
            }
            return vector2s;
        }
        public static System.Numerics.Vector2[] ToVector2(this System.Windows.Vector[] points)
        {
            System.Numerics.Vector2[] vector2s = new Numerics.Vector2[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                vector2s[i] = points[i].ToVector2();
            }
            return vector2s;
        }
        public static System.Windows.Vector ToVector(this System.Numerics.Vector2 point)
        {
            return new System.Windows.Vector(Convert.ToDouble(point.X), Convert.ToDouble(point.Y));
        }
        public static System.Windows.Point ToPoint(this System.Numerics.Vector2 point)
        {
            return new System.Windows.Point(Convert.ToDouble(point.X), Convert.ToDouble(point.Y));
        }
        public static System.Windows.Vector[] ToVector(this System.Numerics.Vector2[] points)
        {
            System.Windows.Vector[] vector2s = new System.Windows.Vector[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                vector2s[i] = points[i].ToVector();
            }
            return vector2s;
        }
        public static System.Windows.Point[] ToPoint(this System.Numerics.Vector2[] points)
        {
            System.Windows.Point[] vector2s = new System.Windows.Point[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                vector2s[i] = points[i].ToPoint();
            }
            return vector2s;
        }


        public static System.Numerics.Vector<double> ToVector2D(this System.Windows.Point point)
        {
            return new Numerics.Vector<double>(new double[] { point.X, point.Y });
        }
        public static System.Numerics.Vector<double> ToVector2D(this System.Windows.Vector point)
        {
            return new Numerics.Vector<double>(new double[] { point.X, point.Y });
        }
    }
}
